﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dominio;
using FluentNHibernate.Mapping;

namespace Infra.NHibernateFramework {
    public class LancamentoMap : ClassMap<Lancamento>{
        public LancamentoMap() {
            Id(x => x.Id, "IdLancamento");

            Map(x => x.Valor)
                .Not.Nullable();
            Map(x => x.Data)
                .Not.Nullable();
            Map(x => x.Tipo, "TipoLancamento")
                .Not.Nullable()
                .CustomType<TipoLancamento>();

            References(x => x.Conta, "IdConta")
                .Not.Nullable();
            References(x => x.Categoria, "IdCategoria")
                .Not.Nullable();
            References(x => x.Contrato, "IdContrato")
                .Cascade.All()
                .Not.Nullable();
        }
    }
}
